package com.wc.AlgoOJ_homework.AlgoOJ_BL3.A_特殊日期;

/**
 * @Author congge
 * @Date 2024/4/4 9:02
 * @description http://43.138.190.70:8888/p/1085?tid=6602a77318e03a818a4bf04e
 */
public class Main {
    static int[] mm = new int[]{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    static int[] divider = new int[2000];

    public static void main(String[] args) {
        int sy = 2000;
        int ey = 2000000;
        // 最后一天的
        int res = 1;
        // 找到y的约束，看看是否满足
        for (int i = sy; i < ey; i++) {
            // 闰年多一天
            if (isRun(i)) mm[2] = 29;
            else mm[2] = 28;

            int idx = 0;
            for (int j = 1; j * j <= i; j++) {
                if (j > 31) break;
                if (i % j == 0) {
                    divider[++idx] = j;
                    if (j * j != i && i / j <= 31) divider[++idx] = i / j;
                }
            }
//            Arrays.sort(divider, 1, idx + 1);
            for (int j = 1; j <= idx; j++) {
                if (divider[j] >= 1 && divider[j] <= 12)
                    for (int k = 1; k <= idx; k++) {
                        if (mm[divider[j]] >= divider[k])
                            res++;
                    }
            }
        }
        System.out.println(res);
    }

    static boolean isRun(int y) {
        return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
    }
}
